package service;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import calendar.Person;
public class QueueConsumer1 implements MessageListener{
	private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();

	public void onMessage(Message message) {
		System.out.println("进入监听器");
		  TextMessage textMessage = (TextMessage)message;
		  try {
			String text = textMessage.getText();
			Person fromJson = gson.fromJson(text, Person.class);
			System.out.println("进入quene"+fromJson.toString());
			
			
			
		} catch (JMSException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		 
	}

}
